// constant

export const getCurYear = () => {
  const now = new Date();
  const currentYear = now.getFullYear();

  const arr = new Array(10).fill('').map((t, c) => {
    return currentYear + c;
  });
  return arr;
};

export const getYear = () => {
  const now = new Date();
  const currentYear = now.getFullYear();

  const arr = new Array(24).fill('').map((t, c) => {
    return currentYear - 16 - c;
  });
  return arr.reverse();
};

export const getMonth = () => {
  return ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
};

export const getDay = (y, m) => {
  let count = 1;
  if (!y && !m) {
    return new Array(30).fill('').map(s => {
      return count < 10 ? `0${count++}` : `${count++}`;
    });
  } else {
    const curDay = new Date(y, m, 0).getDate();
    return new Array(curDay).fill('').map(s => {
      return count < 10 ? `0${count++}` : `${count++}`;
    });
  }
};
